package com.swing_pinea.event;

import com.swing_pinea.render.GameWindow;

import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

import static com.swing_pinea.core.Pinea.PINEA_EVENT_KEY_DOWN;
import static com.swing_pinea.core.Pinea.PINEA_EVENT_KEY_UP;

public class KeyboardsListener extends KeyAdapter {

    @Override
    public void keyPressed(KeyEvent e) {
        GameWindow.getInstance().getEventQueue().offer(new PineaEvent(PINEA_EVENT_KEY_DOWN, e.getKeyCode()));
    }

    @Override
    public void keyReleased(KeyEvent e) {
        GameWindow.getInstance().getEventQueue().offer(new PineaEvent(PINEA_EVENT_KEY_UP, e.getKeyCode()));
    }

}